<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>{$data.name}</title>
	<meta charset="UTF-8">
	{include file='common/head' /}
	<link href="__CSS__/jquery.jqzoom.css" rel="stylesheet" type="text/css" />
	<script src="__JS__/layer/layer.js"></script>

</head>
<body>
<div class="container">
{include file='common/top' /}
	<div class="item">
	    <div class="item-banner"></div>
		<div class="contai">
			<span class="f-bk30"></span><span class="f-bk10"></span>
			<div class="item-con">
				<div class="top">
					<div class="pure-g">
						<div class="pure-u-11-24">
							<div class="left">
								<div class="clearfix">
									<a href="{$data.img}" class="jqzoom" rel='2gal1' title="放大镜" id="jqzoom2">
										<img src="{$data.img}" title="triumph" class="imgleft">
									</a>
								</div>
								<em class="fx"><div class="bdsharebuttonbox bdshare-button-style2-24" data-bd-bind="1502680363045"><a href="#" id="bds_more" class="bds_more" data-cmd="more"></a></div>
									<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"2","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script></em>
								<span class="f-bk"></span>
							</div>
						</div>
						<div class="pure-u-13-24">
							<div class="right">
								<h1>{$data.name}<small>订单类型：即时订单</small></h1>
								<div class="price">
									<div class="p1">
										<p class="p1-1">￥<span>{$data.price}</span></p>
									</div>
									<div class="p2">
										<img src="__IMG__/order-ewm2.jpg" alt="{$data.name}">
									</div>
									<div class="p3 f-fr">关注胎大王</div>
									<span class="f-bk3"></span>
								</div>
								<span class="f-bk30"></span>
								<div class="type">
									<table>
										<tr>
											<td>轮胎品牌：{$data.brand=='胎大王'?"<img src='__IMG__/tdw360.png' width='40'>":$data.brand}</td>
											<td>轮胎规格：{$data.spec}</td>
											<td>轮胎售后：{$data.sanbao}</td>
										</tr>
										<tr>
											<td>轮胎花纹：{$data.huawen}</td>
											<td>库存：{$poolQuantity}</td>
										</tr>
									</table>
								</div>
								<span class="f-bk30"></span>
								<div class="num">购买数量 <span class="num1">-</span><input type="text" id="text_box" name="num" value="1"><span class="num2">+</span></div>
								<span class="f-bk30"></span>
								<input type="hidden" id="poolQuantity" value="{$poolQuantity}" />
								<div class="shop">
									<button type="button" class="sub-buy">立即购买</button>
									<button type="button" class="sub-cart"><i class="fa fa-shopping-cart"></i> 加入购物车</button>
								</div>
							</div>
						</div>
					</div>
					<div class="item-bg"></div>
				</div>
				<div class="f-bk"></div>
				<div class="goods-parameter">
					<table class="goods-table pure-table pure-table-bordered">
						<tr>
							<td>轮胎品牌</td>
							<td>{$data.brand=='胎大王'?"<img src='__IMG__/tdw360.png' width='80'>":$data.brand}</td>
							<td>轮胎花纹</td>
							<td>{$data.huawen}</td>
							<td>轮胎规格</td>
							<td>{$data.spec}</td>
						</tr>
						<tr>
							<td>轮胎类型</td>
							<td>{$data.category}</td>
							<td>三包售后</td>
							<td>{$data.sanbao}</td>
							<td>适用轮位</td>
							<td>{$data.position}</td>
						</tr>
						<tr>
							<td>适用路况</td>
							<td>{$data.lukuang}</td>
							<td>作业里程</td>
							<td>{$data.mileage}</td>
							<td>轮毂直径</td>
							<td>{$data.diameter}</td>
						</tr>
						<tr>
							<td>断面宽</td>
							<td>{$data.wide}</td>
							<td>花纹深度</td>
							<td>{$data.dept}</td>
							<td>载重指数</td>
							<td>{$data.zaizhong}</td>

						</tr>
						<tr>
							<td>速度级别</td>
							<td>{$data.speed}</td>
							<td>束带层结构</td>
							<td>{$data.daishuceng}</td>
							<td colspan="2"><img src="__IMG__/goods-tdw2.png" alt="轮胎参数"> <span style="font-size:24px;font-family: '黑体';font-weight:bold;"></span></td>
						</tr>
					</table>
					<span class="f-bk30"></span>
				</div>
				<div class="goods-content">
                   {$data.introduction}
                    
                </div>
			</div>
			<span class="f-bk20"></span>
		</div>
	</div>
{include file='common/foot' /}
</div>
{include file='common/back' /}
<script type="text/javascript" src="__JS__/lrtk.js"></script>
<script type="text/javascript">
    $(function(){
        var time = 3 * 1000;// 滑动时间间隔
        var bottom_time = 6 * 1000; // 进入下方时滑块时间间隔
        var spLength = $('.i-product-top a').length,
            // scimgWidth = $(window).width(),
            // sulWidth = scimgWidth * spLength,
            sNum = 0;

        // $(".i-product-bottom").width(sulWidth);
        // $(".i-product-bottom a").width(scimgWidth);

        function moveSlide(){
            sNum++;
            if (sNum >= spLength)
            {
                sNum = 0;
            };
            showPics(sNum);
        }
        var sTimer = setInterval(moveSlide,time);
        //鼠标移入下方的块进行滚动
        $('.i-product-top a').hover(function(){
            clearInterval(sTimer);
            sNum = $(this).index();
            setTimeout(function(){ showPics(sNum);},200);
        },function(){
            sTimer = setInterval(moveSlide,bottom_time);
        });
        //图片自动滚动
        function showPics(sNum){
            $(".i-product-top a").eq(sNum);
            // $(".i-product-top div").eq(sNum).find('img').css({'width':'210px','height':'280px'});
            $(".i-product-top a").each(function(index){
                if(sNum!=index){
                    $(this).attr('src','images/t'+index+'_1.jpg');
                    // $(this).css({'width':'200px','height':'250px'});
                }
            });
            $(".i-product-top a").eq(sNum).addClass("sur").siblings().removeClass("sur");
            $(".i-product-bottom a").eq(sNum).addClass("sur_b").siblings().removeClass("sur_b");

        }
    }) ;
</script>

<script src="__JS__/jquery.1.4.2-min.js"></script>
<script src="__JS__/jquery.jqzoom-core.js"></script>
<script>
$(function(){
	$('#jqzoom2').jqzoom({
		zoomType: 'standard',
		zoomWidth: 400,
		zoomHeight: 400,
		xOffset: 80,
		lens: true,
		preloadImages: false,
		alwaysOn: false
	});
	$('.num1').click(function(){
		num = parseInt($('input[name="num"]').val());

		if(num<=1){
			layer.msg("商品数量不能为空",{time:1500});
			$('input[name="num"]').val(1);
			$(this).attr('disabled','disabled');
			return false;
		}else{
			num = num-1;
			$('input[name="num"]').val(num);
		}
	});
	$('.num2').click(function(){
		num = parseInt($('input[name="num"]').val());

		if(num>0){
			num = num+1;
			$('input[name="num"]').val(num);

		}else{
			layer.msg("商品数量不能为空",{time:1500});
			$(this).attr('disabled','disabled');
			return false;
		}
	});
	$(".sub-cart").click(function(){
		var quantity = $("#text_box").val();
		var poolQuantity = $("#poolQuantity").val();
		var productId = {$data["id"]};
		if (/^\d*[1-9]\d*$/.test(quantity) && parseInt(quantity) > 0) {
			if(parseInt(poolQuantity)<parseInt(quantity)){
				layer.msg("库存不足无法加入购物车",{time:1500});
				return false;
			}			
			$.ajax({
				url: "/Cart/addCart.html",
				type: "POST",
				data: {id:productId,quantity:quantity},
				dataType: "json",
				cache: false,
				success: function(data) {
					if(data.code==1){
						layer.msg("添加成功",{time:1500});
					}else if(data.code==1004){
						layer.alert(data.msg,function(){
							window.location.href='/login/jump/deposit.html';					
						});						
					}else{
						layer.msg(data.msg,{time:1500});
					}
				}
			});
		} else {
			layer.msg("加入购物车失败",{time:1500});
		}
	});
	$(".sub-buy").click(function(){
		var quantity = $("#text_box").val();
		var poolQuantity = $("#poolQuantity").val();
		var productId = {$data["id"]};
		if (/^\d*[1-9]\d*$/.test(quantity) && parseInt(quantity) > 0) {
			if(parseInt(poolQuantity)<parseInt(quantity)){
				layer.msg("库存不足无法购买",{time:1500});
				return false;
			}
			$.ajax({
				url: "/Cart/addCart.html",
				type: "POST",
				data: {id:productId,quantity:quantity},
				dataType: "json",
				cache: false,
				success: function(data) {
					if(data.code==1){
						//layer.alert("添加成功",function(){
							window.location.href='/cart.html';					
						//});	
					}else if(data.code==1004){
						layer.alert(data.msg,function(){
							window.location.href='/login/jump/deposit.html';					
						});						
					}else{
						layer.msg(data.msg,{time:1500});
					}
				}
			});
		} else {
			layer.msg("购买失败",{time:1500});
		}
	});	
});
</script>
<script src="__JS__/jquery.cookie.js"></script>
<script>
$(function(){
	var userInfo = $.cookie('userInfo');
	if(userInfo!=null){
		$(".indexLogin").css("display","none");
		$(".memberLogin").css("display","block");
		var str = userInfo.replace(/^think:/,'');
		userInfo = JSON.parse(str);
		//console.log(JSON.parse(str));
		$(".memberLogin .memberPhone").text(userInfo['username']);
	}else{
		$(".indexLogin").css("display","block");
		$(".memberLogin").css("display","none");
	}

});
</script>
</body>
</html>